package com.zimin.common.exception;

import com.zimin.common.utils.ObjectUtils;
import com.zimin.shared.enums.ResponseStatusEnum;

/**
 * 封装异常处理
 * <p>
 * 不使用当前类，可查看最新异常处理方式{@link GraceException}
 *
 * @author zimin
 * @since 2021/10/22 10:57 上午
 */
@Deprecated
public class Assert extends org.springframework.util.Assert {

    public static void isFalse(boolean expression, ResponseStatusEnum responseStatusEnum) {
        if (expression) {
            GraceException.display(responseStatusEnum);
        }
    }

    public static void isNull(Object object, ResponseStatusEnum responseStatusEnum) {
        if (ObjectUtils.isEmpty(object)) {
            GraceException.display(responseStatusEnum);
        }
    }

    public static void isNotNull(boolean expression, ResponseStatusEnum responseStatusEnum) {
        if (expression) {
            GraceException.display(responseStatusEnum);
        }
    }


    public static void isNotNull(Object object, ResponseStatusEnum responseStatusEnum) {
        if (ObjectUtils.isNotEmpty(object)) {
            GraceException.display(responseStatusEnum);
        }
    }
}
